<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/faces/site/xhtml/templates/template.xhtml">
		<ui:define name="body-imobiliaria">		
			<table id="complex-main-body" cellpadding="0" cellspacing="0">
				<tbody>
					<tr>
						<td id="menu-body" valign="top">
							<ui:insert name="menu-left-imobiliaria">
								<ui:include src="/faces/site/xhtml/templates/menu-left.xhtml" />
							</ui:insert>							
						</td>						
						<td id="content-body">							
							<h:form id="form-imoveis">
								<table cellpadding="0" cellspacing="0" width="100%">
									<p:outputPanel id="media-banner" rendered="#{searchImovelController.cliente.template.banner != null and searchImovelController.searched == false}">
										<tr>
											<td>
												<div class="banner-imovel">
													<p:media value="#{searchImovelController.cliente.template.mediaBanner}" width="780" height="200" player="flash">
														<f:param name="wmode" value="transparent"/>
													</p:media> 												
												</div>											
											</td>
										</tr>
									</p:outputPanel>																									
									<tr>
										<td>
											<p:outputPanel id="imoveis-grid-panel">																				
												<p:dataTable 
													var="anuncio" 
													value="#{searchImovelController.lazyModelAnuncio}" 
													rows="#{searchImovelController.pageSize}" 
													paginator="true"
													emptyMessage="#{msg['messages.list.not.found']}"
													rowStyleClass="row-content">
													
													<p:column style="padding: 2px;">
														<table cellpadding="0" cellspacing="0" style="border-color: white;">
															<tr class="result-search-row">
																<td width="155px">
																	<p:commandLink oncomplete="fotografiasDialog.show()" update=":fotografia-panel"
																		actionListener="#{searchImovelController.auditarClick}" rendered="#{!anuncio.albumIsEmpty}">
																		<f:param name="idAnuncio" value="#{anuncio.id}" />
																		<f:param name="tipo" value="F" />
																		<p:graphicImage value="#{anuncio.logo}" />
																	</p:commandLink>
																	<p:graphicImage value="#{anuncio.logo}" rendered="#{anuncio.albumIsEmpty}" />																																																
																</td>
																<td width="500px" style="vertical-align: top;padding: 0px;">
																	<table cellpadding="0" cellspacing="0" style="margin: 0px;">
																		<tr class="result-search-row">
																			<td class="result-search-column-title"><b><h:outputText value="#{anuncio.empresa.pessoaJuridica.nome}" /></b></td>
																		</tr>	
																		<tr class="result-search-row">
																			<td  style="padding: 0px;">
																				<table cellpadding="0" cellspacing="0" width="100%">
																					<tr class="result-search-row">
																						<td width="90%" style="padding: 0px;vertical-align: top;">
																							<table cellpadding="0" cellspacing="0" width="100%">
																								<tr class="result-search-row">
																									<td colspan="2">
																										<b><h:outputText value="#{msg['template.codigo.title']}"/>:</b>
																										<p:spacer width="5px"/><h:outputText value="#{anuncio.id}" />
																									</td>
																								</tr>																																																
																								<tr class="result-search-row">
																									<td width="5%" align="left"><h:outputText value="#{msg['template.tipo.title']}"/>: </td>
																									<td width="95%" style="text-align: left;padding: 0px;">																										
																										<h:outputText value="#{anuncio.tipoNegociacaoDesc}" />
																										<p:spacer width="5px"/>|<p:spacer width="5px"/>
																										<h:outputText value="#{anuncio.subCategoria.nome}" />																										
																									</td>																									
																								</tr>							
																								<tr class="result-search-row">
																									<td colspan="2" style="text-align: left;">			
																										<h:outputText value="#{anuncio.empresa.endereco.bairro}"/><p:spacer width="5px"/>|<p:spacer width="5px"/>																							
																										<h:outputText value="#{anuncio.empresa.endereco.municipio.nome}" /><p:spacer width="2px"/>/<p:spacer width="2px"/>
																										<h:outputText value="#{anuncio.empresa.endereco.municipio.estado.sigla}" />																																																																														
																									</td>																									
																								</tr>																			
																								<tr class="result-search-row">
																									<td colspan="2" style="text-align: left;">
																										<div class="limit-string"><h:outputText value="#{anuncio.descricao}" /></div>
																									</td>
																								</tr>
																								<tr class="result-search-row">
																									<td style="text-align: left;" colspan="2">
																										<p:outputPanel rendered="#{anuncio.dormitorios > 0}">
																											<h:outputText value="#{anuncio.dormitorios}" /><p:spacer width="5px" /> 
																											<h:outputText value="#{msg['template.dormitorios.title']}" rendered="#{anuncio.dormitorios > 1}" />
																											<h:outputText value="#{msg['template.dormitorio.title']}" rendered="#{anuncio.dormitorios == 1}" />
																											<p:spacer width="10px" />	
																										</p:outputPanel>
																										<p:outputPanel rendered="#{anuncio.suites > 0}">
																											<h:outputText value="#{anuncio.suites}" /><p:spacer width="5px" /> 
																											<h:outputText value="#{msg['template.suites.title']}" rendered="#{anuncio.suites > 1}" />
																											<h:outputText value="#{msg['template.suite.title']}" rendered="#{anuncio.suites == 1}" />
																											<p:spacer width="10px" />	
																										</p:outputPanel>
																										<p:outputPanel rendered="#{anuncio.banheiros > 0}">
																											<h:outputText value="#{anuncio.banheiros}" /><p:spacer width="5px" /> 
																											<h:outputText value="#{msg['template.banheiros.title']}" rendered="#{anuncio.banheiros > 1}" />
																											<h:outputText value="#{msg['template.banheiro.title']}" rendered="#{anuncio.banheiros == 1}" />
																											<p:spacer width="10px" />	
																										</p:outputPanel>
																										<h:outputText value="#{msg['template.areaUtil.title']}" />:<p:spacer width="3px" />
																										<h:outputText value="#{anuncio.areaUtil}" />m2																										
																									</td>
																								</tr>		
																								<tr class="result-search-row">
																									<td class="result-search-column-title" colspan="2">
																										<b><h:outputText value="#{msg['template.valor.title']}" />:<p:spacer width="3px" />R$
																										<h:outputText value="#{anuncio.preco}">
																											<f:convertNumber pattern = "#,###.00"/>
																										</h:outputText>
																										</b>
																									</td>
																								</tr>	
																								<tr class="result-search-row">
																									<td class="result-search-column-title" colspan="2">
																										<h:commandLink value="" onclick="javascript:window.open('http://www.facebook.com/sharer.php?u=http://www.localfloripa.com.br/imobiliarias/#{anuncio.cliente.template.url}','facebook','height=320,width=640,toolbar=no,scrollbars=no')">  
        																									<p:graphicImage value="#{resource['images:icons/24x24/facebook_share.png']}" width="24px" height="24px"/>
    																									</h:commandLink>  																																																			
																										<p:spacer width="3px"/>
																										<h:commandLink value="" onclick="javascript:window.open('http://twitter.com/home?status=http://www.localfloripa.com.br/imobiliarias/#{anuncio.cliente.template.url}','twitter','height=320,width=640,toolbar=no,scrollbars=no')">  
        																									<p:graphicImage value="#{resource['images:icons/24x24/twitter_share.png']}" width="24px" height="24px"/>
    																									</h:commandLink>  																											 																								
																									</td>
																								</tr>																				
																							</table>
																						</td>
																					
																						<td width="10%" style="padding: 0px;">
																							<table cellpadding="0" cellspacing="0" style="background-color: #E5E5E5;">
																								<tr class="result-links-imoveis">
																									<td> 
																										<p:commandLink value="#{msg['search.result.mapa.label']}" oncomplete="mapaDialog.show()" actionListener="#{searchImovelController.loadAnuncioById}" update=":mapa-panel" >																
																											<f:param name="idAnuncio" value="#{anuncio.id}" />
																										</p:commandLink>
																									</td>
																								</tr>
																								<tr class="result-links-imoveis">
																									<td>
																										<p:commandLink value="#{msg['search.result.telefone.label']}" oncomplete="telefonesDialog.show()" update=":telefone-panel" 
																											actionListener="#{searchImovelController.auditarClick}">
																											<f:param name="idAnuncio" value="#{anuncio.id}" />
																											<f:param name="tipo" value="T" />
																										</p:commandLink>	
																									</td>
																								</tr>
																								<tr class="result-links-imoveis">
																									<td>
																										<p:commandLink value="#{msg['search.result.email.label']}" oncomplete="contatoDialog.show()" update=":contato-panel" 
																											actionListener="#{searchImovelController.loadAnuncioById}">
																											<f:param name="idAnuncio" value="#{anuncio.id}" />
																										</p:commandLink>
																									</td>
																								</tr>																								
																							</table>																																																																		
																						</td>
																					</tr>							
																				</table>
																			</td>
																		</tr>																																		
																	</table>																					
																</td>																
																<td>
																	<p:gmap center="#{anuncio.localizacao}" zoom="15" model="#{anuncio.mapModel}" type="terrain" 
																		style="width:180px;height:120px" mapTypeControl="false" navigationControl="false" />  
																</td>
															</tr>
														</table>															
													</p:column>													
													
												</p:dataTable>
											</p:outputPanel>	
										</td>
									</tr>
								</table>														
							</h:form>
						</td>
					</tr>
				</tbody>	
			</table>		
			<p:dialog header="#{msg['search.anuncio.reputacao.comentario.title']}" widgetVar="comentarioAtendimentoDialog" resizable="false"  
             	width="420" showEffect="clip" hideEffect="fold" position="top" modal="true" styleClass="dialog" onHide="clearFieldsFormAtendimento()"> 
        	
	        	<p:outputPanel id="comentario-atendimento-panel">
	        		<h:form id="form-atendimento">
			           	<table cellpadding="0" cellspacing="0">
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.nome']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="nomeAtendimento" value="#{searchImovelController.avaliacao.nome}" styleClass="inputText" />
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.email']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="emailAtendimento" value="#{searchImovelController.avaliacao.email}" styleClass="inputText" />	
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.descricao']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputTextarea id="descricaoAtendimento" value="#{searchImovelController.avaliacao.descricao}" styleClass="inputTextArea" maxHeight="120" maxlength="255"/>
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-buttons" colspan="2">
			           				<p:commandButton value="#{msg['search.anuncio.comentario.send']}" actionListener="#{searchImovelController.handleRate}" 
			           					 ajax="true" oncomplete="comentarioAtendimentoDialog.hide()" update=":form-imoveis:imoveis-grid-panel" icon="send-button"/>
			           			</td>
			           		</tr>
			           	</table>
		          	</h:form>
	           </p:outputPanel>              			              
	        </p:dialog>
	        
	        <p:dialog header="#{msg['search.anuncio.reputacao.comentario.title']}" widgetVar="comentarioServicoDialog" resizable="false"  
	             	width="420" showEffect="clip" hideEffect="fold" position="top" modal="true" styleClass="dialog" onHide="clearFieldsFormServico()"> 
	             	
	        	<p:outputPanel id="comentario-servico-panel">
	        		<h:form id="form-servico">
			           	<table cellpadding="0" cellspacing="0">
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.nome']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="nomeServico" value="#{searchImovelController.avaliacao.nome}" styleClass="inputText" />
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.email']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="emailServico" value="#{searchImovelController.avaliacao.email}" styleClass="inputText" />	
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.comentario.descricao']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputTextarea id="descricaoServico" value="#{searchImovelController.avaliacao.descricao}" styleClass="inputTextArea" maxHeight="120" maxlength="255"/>
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-buttons" colspan="2">
			           				<p:commandButton value="#{msg['search.anuncio.comentario.send']}" actionListener="#{searchImovelController.handleRate}" 
			           					 ajax="true" oncomplete="comentarioServicoDialog.hide()" update=":form-imoveis:imoveis-grid-panel" icon="send-button"/>
			           			</td>
			           		</tr>
			           	</table>
		          	</h:form>
	           </p:outputPanel> 	             
	        </p:dialog>	
	        
	        <p:dialog header="#{msg['search.anuncio.contato.title']}" widgetVar="contatoDialog" resizable="false"  
	             	width="420" showEffect="clip" hideEffect="fold" position="top" modal="true" styleClass="dialog" onHide="clearFieldsFormContato()"> 
	             	
	        	<p:outputPanel id="contato-panel">
	        		<h:form id="form-contato">
			           	<table cellpadding="0" cellspacing="0">
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.contato.nome']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="nomeMensagem" value="#{searchImovelController.mensagem.nome}" styleClass="inputText" />
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.contato.email']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputText id="emailMensagem" value="#{searchImovelController.mensagem.email}" styleClass="inputText" />	
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-label"><h:outputText value="#{msg['search.anuncio.contato.descricao']}" />:</td>
			           			<td class="form-column-value">
			           				<p:inputTextarea id="descricaoMensagem" value="#{searchImovelController.mensagem.descricao}" styleClass="inputTextArea" maxHeight="120" maxlength="255"/>
			           			</td>
			           		</tr>
			           		<tr>
			           			<td class="form-column-buttons" colspan="2">
			           				<p:commandButton value="#{msg['search.anuncio.contato.send']}" ajax="true" oncomplete="contatoDialog.hide()"
			           					update=":form-imoveis:imoveis-grid-panel" icon="send-button" actionListener="#{searchImovelController.sendMessage}"/>
			           			</td>
			           		</tr>
			           	</table>
		          	</h:form>
	           </p:outputPanel> 	             
	        </p:dialog>			
	        
	        <p:dialog header="#{msg['search.anuncio.reputacao.comentarios.title']}" widgetVar="comentariosDialog" resizable="false"  
	             	width="620" showEffect="clip" hideEffect="fold" position="top" modal="true" styleClass="dialog">
	        	<p:outputPanel id="comentarios-panel">
	        		<h:form>
	        			<p:dataTable 
	        				var="avaliacao" 
	        				value="#{searchImovelController.anuncio.avaliacoes}" 
	        				scrollable="true" 
	        				scrollHeight="200"
	        				resizableColumns="true"
	        				emptyMessage="#{msg['messages.list.not.found']}">
	        				        			
	        				<p:column styleClass="search-comentarios-column-tipo" headerText="#{msg['search.anuncio.comentario.tipo']}">        					
		        				<h:outputText value="#{msg['search.anuncio.comentario.tipo.atendimento']}" rendered="#{avaliacao.tipoAvaliacao == 'ATENDIMENTO'}"/>
		        				<h:outputText value="#{msg['search.anuncio.comentario.tipo.servico']}" rendered="#{avaliacao.tipoAvaliacao == 'SERVICO'}"/>
		        			</p:column>
		        			<p:column styleClass="search-comentarios-column-nome" headerText="#{msg['search.anuncio.comentario.nome']}">
		        				<h:outputText value="#{avaliacao.nome}" />
		        			</p:column>
		        			<p:column styleClass="search-comentarios-column-nota" headerText="#{msg['search.anuncio.comentario.rate']}">
		        				<h:outputText value="#{avaliacao.descClassificacao}" />
		        			</p:column>
		        			<p:column styleClass="search-comentarios-column-descricao" headerText="#{msg['search.anuncio.comentario.descricao']}">
		        				<h:outputText value="#{avaliacao.descricao}" />
		        			</p:column>
	        			</p:dataTable>
	        		</h:form>        		        		
	        	</p:outputPanel>
	        </p:dialog>
	        
	        <p:dialog header="#{msg['search.result.album.label']}" widgetVar="fotografiasDialog" resizable="false" 
	        	modal="true" styleClass="dialog" showEffect="clip" position="top" width="600" height="450">        	
	        	<p:outputPanel id="fotografia-panel">
	        		<p:commandButton type="button" onclick="switcherAnuncio.previous();" icon="ui-icon-circle-triangle-w" />  
					<p:spacer height="10px;" width="10px"/>
					<p:commandButton type="button" onclick="switcherAnuncio.next();" icon="ui-icon-circle-triangle-e"/>  
					
					<p:separator style="width:100%;height:1px;" />
					
					<p:imageSwitch effect="wipe" widgetVar="switcherAnuncio" slideshowAuto="false" style="display: block;margin-left: auto;margin-right: auto;">  
					    <ui:repeat value="#{searchImovelController.anuncio.album}" var="image">  
					        <p:graphicImage value="#{image.originalImage}"/>  
					    </ui:repeat>  
					</p:imageSwitch> 					
	        		        		
	        	</p:outputPanel>         	
	        </p:dialog>
	        
	        <p:dialog header="#{msg['search.result.telefone.label']}" widgetVar="telefonesDialog" resizable="false" 
	        	modal="true" styleClass="dialog" showEffect="clip" position="top" width="220" height="120">
	        	<p:outputPanel id="telefone-panel">
	       		 	<table cellpadding="0" cellspacing="0">
		           		<tr>
		           			<td class="form-column-label"><h:outputText value="#{msg['manager.cliente.create.telefone.fixo']}" />:</td>
		           			<td class="form-column-value">
		           				<h:outputText value="#{searchImovelController.anuncio.empresa.telefoneFixo}" />
		           			</td>
		           		</tr>
		           		<tr>
		           			<td class="form-column-label"><h:outputText value="#{msg['manager.cliente.create.telefone.celular']}" />:</td>
		           			<td class="form-column-value">
		           				<h:outputText value="#{searchImovelController.anuncio.empresa.telefoneCelular}" />
		           			</td>
		           		</tr>
		           	</table>
	        	</p:outputPanel>
	        </p:dialog>
	        
	        <p:dialog header="#{msg['search.result.mapa.label']}" widgetVar="mapaDialog" resizable="false" modal="true" position="top" width="500" showEffect="clip" onShow="reloadMapa()"> 
	        	<p:outputPanel id="mapa-panel">
	        		<p:gmap widgetVar="zoomMap" center="#{searchImovelController.anuncio.localizacao}" model="#{searchImovelController.anuncio.mapModel}" zoom="15" type="terrain" 
	       				style="width:480px;height:300px" mapTypeControl="false" navigationControl="false" />
	        	</p:outputPanel>       	       	       	  
	        </p:dialog>
		</ui:define>
	</ui:composition>
</html>